
layui.use(['layer', 'form', 'ax'], function () {
    var $ = layui.$;
    var $ax = layui.ax;
    var form = layui.form;

    // 表单提交事件
    form.on('submit(btnSubmit)', function (data) {
        var ajax = new $ax(system.contextPath + "/admin/user/set/password", function (res) {
            if(res.status){
                system.success("修改成功！");
            }else{
                system.error("修改失败！" + res.msg);
            }
        }, function (res) {
            system.error("修改失败！" + res.msg);
        });
        ajax.set(data.field);
        ajax.start();

        return false;
    });

    form.verify({
        password: [/^[\S]{5,12}$/,'密码必须6到12位，且不能出现空格'],
        passwordTo: function(value ,item){
            if($("#password").val() != value){
                return '密码不一致';
            }
        }
    });
});